* do file to convert Country names into Country numbers

gen cowcode=.

replace cowcode=700 if Country=="Afghanistan"
replace cowcode=700 if Country=="Afghanistan, I.R. of"
replace cowcode=615 if Country=="Algeria"
replace cowcode=540 if Country=="Angola"
replace cowcode=540 if Country=="People's Republic of Angola"
replace cowcode=339 if Country=="Albania"
replace cowcode=160 if Country=="Argentina"
replace cowcode=371 if Country=="Armenia"
replace cowcode=58 if Country=="Antigua and Barbuda"
replace cowcode=900 if Country=="Australia"
replace cowcode=305 if Country=="Austria"
replace cowcode=373 if Country=="Azerbaijan"
replace cowcode=373 if Country=="Azerbaijan, Rep. of"

replace cowcode=692 if Country=="Bahrain, Kingdom of"
replace cowcode=692 if Country=="Bahrain"

replace cowcode=31 if Country=="Bahamas, The"
replace cowcode=31 if Country=="Bahamas"

replace cowcode=771 if Country=="Bangladesh"
replace cowcode=53 if Country=="Barbados"
replace cowcode=211 if Country=="Belgium"
replace cowcode=370 if Country=="Belarus"
replace cowcode=80 if Country=="Belize"
replace cowcode=434 if Country=="Benin"
replace cowcode=760 if Country=="Bhutan"
replace cowcode=145 if Country=="Bolivia"

replace cowcode=346 if Country=="Bosnia & Herzegovina"
replace cowcode=346 if Country=="Bosnia and Herzegovina"
replace cowcode=346 if Country=="Bosnia-Herzegovina"

replace cowcode=571 if Country=="Botswana"
replace cowcode=140 if Country=="Brazil"
replace cowcode=835 if Country=="Brunei"
replace cowcode=835 if Country=="Brunei Darussalam"
replace cowcode=355 if Country=="Bulgaria"
replace cowcode=439 if Country=="Burkina Faso"
replace cowcode=516 if Country=="Burundi"

replace cowcode=811 if Country=="Cambodia"
replace cowcode=811 if Country=="The Khmer Republic"
replace cowcode=811 if Country=="Kampuchea"

replace cowcode=20 if Country=="Canada"

replace cowcode=482 if Country=="Central African Rep."
replace cowcode=482 if Country=="Central African Republic"

replace cowcode=483 if Country=="Chad"
replace cowcode=155 if Country=="Chile"

replace cowcode=710 if Country=="China,P.R.: Mainland"
replace cowcode=710 if Country=="China"
replace cowcode=710 if Country=="China, People's Republic of"


replace cowcode=713 if Country=="Taiwan"



replace cowcode=437 if Country=="Cote d'Ivoire"
replace cowcode=437 if Country=="Cote D'Ivoire"
replace cowcode=437 if Country == "Ivory Coast"
replace cowcode=437 if Country == "Cote d`Ivoire"

replace cowcode=471 if Country=="Cameroon"
replace cowcode=100 if Country=="Colombia"
replace cowcode=100 if Country=="Columbia"
replace cowcode=581 if Country=="Comoros"
replace cowcode=402 if Country=="Cape Verde"
replace cowcode=94 if Country=="Costa Rica"
replace cowcode=344 if Country=="Croatia"
replace cowcode=40 if Country=="Cuba"
replace cowcode=352 if Country=="Cyprus"

replace cowcode=315 if Country == "Czechoslovakia"
replace cowcode=316 if Country=="Czech Republic"

replace cowcode=522 if Country=="Djibouti"

replace cowcode=255 if Country=="Germany" & Year <= 1945
replace cowcode=255 if Country=="Germany" & Year >= 1991

replace cowcode = 260 if Country=="Germany" & Year >= 1949 & Year <= 1990
replace cowcode = 260 if Country=="West Germany" & Year >= 1949 & Year <= 1990
replace cowcode = 260 if Country=="Germany Federal Republic of" & Year >= 1949 & Year <= 1990
replace cowcode = 260 if Country=="Germany Federal Republic" & Year >= 1949 & Year <= 1990
replace cowcode = 260 if Country=="Federal Republic of Germany" & Year >= 1949 & Year <= 1990



replace cowcode=265 if Country=="East Germany" & Year >= 1949 & Year <= 1990
replace cowcode=265 if Country=="German Democratic Republic" & Year >= 1949 & Year <= 1990

replace cowcode=54  if Country=="Dominica"
replace cowcode=390 if Country=="Denmark"
replace cowcode=42 if Country=="Dominican Republic"

replace cowcode=860 if Country=="East Timor"
replace cowcode=130 if Country=="Ecuador"
replace cowcode=130 if Country=="Equador"
replace cowcode=651 if Country=="Egypt" 
replace cowcode = 651 if Country == "Egypt, Arab Rep."
replace cowcode = 651 if Country == "Egypt, Arab Republic"
replace cowcode=92 if Country=="El Salvador"
replace cowcode=531 if Country=="Eritrea"
replace cowcode=366 if Country=="Estonia"
replace cowcode=530 if Country=="Ethiopia"
replace cowcode=530 if Country=="Ethiopia "

replace cowcode=950 if Country=="Fiji"
replace cowcode=375 if Country=="Finland"
replace cowcode=220 if Country=="France"

replace cowcode=481 if Country=="Gabon"
replace cowcode=372 if Country=="Georgia"
replace cowcode=452 if Country=="Ghana"
replace cowcode=438 if Country=="Guinea"
replace cowcode=420 if Country=="Gambia, The"
replace cowcode=404 if Country=="Guinea-Bissau"
replace cowcode=404 if Country=="Guinea Bissau"

replace cowcode=411 if Country=="Equatorial Guinea"

replace cowcode=350 if Country=="Greece"
replace cowcode=55 if Country=="Grenada"
replace cowcode=90 if Country=="Guatemala"
replace cowcode=110 if Country=="Guyana"

replace cowcode=91 if Country=="Honduras"
replace cowcode=41 if Country=="Haiti"
replace cowcode=310 if Country=="Hungary"

replace cowcode=850 if Country=="Indonesia"
replace cowcode=850 if Country=="indonesia"
replace cowcode=750 if Country=="India"
replace cowcode=205 if Country=="Ireland"
replace cowcode=205 if Country=="Eire"

replace cowcode=630 if Country=="Iran, I.R. of"
replace cowcode=630 if Country=="Iran"
replace cowcode = 630 if Country == "Iran, Islamic Rep."
replace cowcode = 630 if Country == "Iran, Islamic Republic"

replace cowcode=645 if Country=="Iraq"
replace cowcode=395 if Country=="Iceland"
replace cowcode=666 if Country=="Israel"
replace cowcode=325 if Country=="Italy"

replace cowcode=51 if Country=="Jamaica"
replace cowcode=663 if Country=="Jordan"
replace cowcode=740 if Country=="Japan"

replace cowcode=705 if Country=="Kazakhstan"
replace cowcode=705 if Country=="Kazakstan"

replace cowcode=501 if Country=="Kenya"
replace cowcode=703 if Country=="Kyrgyz Republic"
replace cowcode=703 if Country=="Kyrgyzstan"

replace cowcode=732 if Country=="Korea"
replace cowcode=732 if Country=="Korea, South"
replace cowcode=732 if Country=="Korea, South (Rep.)"
replace cowcode=732 if Country=="Korea Republic of"
replace cowcode=732 if Country=="Korea, Republic of"
replace cowcode=732 if Country=="Republic of Korea"
replace cowcode=732 if Country=="Korea, Rep."
replace cowcode=732 if Country=="Korea, ROK"
replace cowcode=732 if Country=="South Korea"


replace cowcode=731 if Country=="Korea, dem. rep."
replace cowcode=731 if Country=="Korea, North"
replace cowcode = 731 if Country=="Korea, Dem. Rep."
replace cowcode = 731 if Country=="Korea, North (Dem. Rep.)"
replace cowcode = 731 if Country=="Korea, Democratic Republic"
replace cowcode = 731 if Country=="Korea Democratic Republic"
replace cowcode = 731 if Country=="Korea, DPRK"
replace cowcode = 731 if Country =="Democratic Peoples Republic of Korea"
replace cowcode = 731 if Country =="Democratic People's Republic of Korea"
replace cowcode = 731 if Country =="North Korea"


replace cowcode=690 if Country=="Kuwait"

replace cowcode=812 if Country=="Lao People's Dem Rep"
replace cowcode=812 if Country=="Lao People's Dem.Rep"
replace cowcode=812 if Country=="Lao People's Democratic Republic"
replace cowcode=812 if Country=="Laos"
replace cowcode=812 if Country=="Laos PDR"

replace cowcode=660 if Country=="Lebanon"
replace cowcode=450 if Country=="Liberia"
replace cowcode=620 if Country=="Libya"
replace cowcode=570 if Country=="Lesotho"
replace cowcode=368 if Country=="Lithuania"
replace cowcode=212 if Country=="Luxembourg"
replace cowcode=223 if Country=="Liechtenstein"
replace cowcode=223 if Country=="Leichtenstein"
replace cowcode=367 if Country=="Latvia"

replace cowcode=580 if Country=="Madagascar"
replace cowcode=600 if Country=="Morocco"
replace cowcode=359 if Country=="Moldova"
replace cowcode=781 if Country=="Maldives"
replace cowcode=781 if Country=="Maldive Islands"
replace cowcode=70 if Country=="Mexico"
replace cowcode=983 if Country=="Marshall Islands"
replace cowcode=343 if Country=="Macedonia, FYR"
replace cowcode=343 if Country=="Macedonia"
replace cowcode=432 if Country=="Mali"
replace cowcode=338 if Country=="Malta"

replace cowcode = 987 if Country=="Micronesia, Fed. Sts."
replace cowcode = 987 if Country=="Micronesia, Fed.Sts."
replace cowcode = 987 if Country=="Micronesia"
replace cowcode = 987 if Country=="Federated States of Micronesia"
replace cowcode=987 if Country=="Micronesia fed. sts."

replace cowcode=775 if Country=="Myanmar"
replace cowcode=775 if Country=="Myanmar (Burma)"
replace cowcode=775 if Country=="Burma"
replace cowcode=775 if Country=="Burma"

replace cowcode=712 if Country=="Mongolia"
replace cowcode=221 if Country=="Monaco"
replace cowcode=541 if Country=="Mozambique"
replace cowcode=435 if Country=="Mauritania"
replace cowcode=590 if Country=="Mauritius"
replace cowcode=553 if Country=="Malawi"
replace cowcode=820 if Country=="Malaysia"

replace cowcode=565 if Country=="Namibia"
replace cowcode=970 if Country=="Nauru"
replace cowcode=436 if Country=="Niger"
replace cowcode=475 if Country=="Nigeria"
replace cowcode=93 if Country=="Nicaragua"
replace cowcode=210 if Country=="Netherlands"
replace cowcode=385 if Country=="Norway"
replace cowcode=790 if Country=="Nepal"
replace cowcode=920 if Country=="New Zealand"

replace cowcode=698 if Country=="Oman"

replace cowcode=770 if Country=="Pakistan"
replace cowcode=95 if Country=="Panama"
replace cowcode=135 if Country=="Peru"
replace cowcode=840 if Country=="Philippines"
replace cowcode=986 if Country=="Palau"
replace cowcode=910 if Country=="Papua New Guinea"
replace cowcode=290 if Country=="Poland"
replace cowcode=235 if Country=="Portugal"
replace cowcode=150 if Country=="Paraguay"

replace cowcode=694 if Country=="Qatar"

replace cowcode=360 if Country=="Romania"

replace cowcode=365 if Country=="Russia"
replace cowcode=365 if Country=="Russian Federation"
replace cowcode=365 if Country=="USSR"
replace cowcode=365 if Country=="U.S.S.R."

replace cowcode=517 if Country=="Rwanda"

replace cowcode=990 if Country=="Samoa"
replace cowcode=990 if Country=="Western Samoa"

replace cowcode=670 if Country=="Saudi Arabia"

replace cowcode=625 if Country=="Sudan"

replace cowcode=433 if Country=="Senegal"
replace cowcode=433 if Country=="Senegambia"

replace cowcode=830 if Country=="Singapore"

replace cowcode=940 if Country=="Solomon Islands"

replace cowcode=451 if Country=="Sierra Leone"
replace cowcode=451 if Country=="Sierra Leonne"

replace cowcode=331 if Country=="San Marino"

replace cowcode=591 if Country=="Seychelles"

replace cowcode=520 if Country=="Somalia"
replace cowcode=520 if Country=="Somali Democratic Republic"
replace cowcode=520 if Country=="Somali Republic"

replace cowcode=520 if Country=="Somaliland"

replace cowcode=560 if Country=="South Africa"

replace cowcode=230 if Country=="Spain"

replace cowcode=403 if Country=="Sao Tome and Principe"

replace cowcode=780 if Country=="Sri Lanka"

replace cowcode=115 if Country=="Suriname"
replace cowcode=115 if Country=="Surinam"

replace cowcode=317 if Country=="Slovak Republic"
replace cowcode=317 if Country=="Slovakia"

replace cowcode=349 if Country=="Slovenia"

replace cowcode=57 if Country=="St. Vincent & Grens."
replace cowcode=57 if Country=="Saint Vincent and Grenadines"
replace cowcode=57 if Country=="St. Vincent and the Grenadines"

replace cowcode=56  if Country=="St. Lucia"
replace cowcode=56  if Country=="Saint Lucia"
replace cowcode=60 if Country=="St. Kitts and Nevis"
replace cowcode=60 if Country=="St Kitts & Nevis"

replace cowcode=380 if Country=="Sweden"

replace cowcode=572 if Country=="Swaziland"

replace cowcode=225 if Country=="Switzerland"

replace cowcode=652 if Country=="Syrian Arab Republic"
replace cowcode=652 if Country=="Syria"
replace cowcode = 652 if Country == "Syrian Arab Rep."

replace cowcode=461 if Country=="Togo"
replace cowcode=955 if Country=="Tonga"
replace cowcode=800 if Country=="Thailand"
replace cowcode=702 if Country=="Tajikistan"
replace cowcode=702 if Country=="Tajikstan"

replace cowcode=701 if Country=="Turkmenistan"
replace cowcode=52 if Country=="Trinidad and Tobago"
replace cowcode=52 if Country=="Trinidad & Tobago"
replace cowcode=616 if Country=="Tunisia"
replace cowcode=640 if Country=="Turkey"
replace cowcode=510 if Country=="Tanzania"
replace cowcode=947 if Country=="Tuvalu"

replace cowcode=500 if Country=="Uganda"
replace cowcode=369 if Country=="Ukraine"
replace cowcode=165 if Country=="Uruguay"
replace cowcode=696 if Country=="United Arab Emirates"
replace cowcode=200 if Country=="United Kingdom"
replace cowcode=696 if Country=="UAE"
replace cowcode=2 if Country=="United States"
replace cowcode=2 if Country=="USA"
replace cowcode=704 if Country=="Uzbekistan"

replace cowcode=101 if Country=="Venezuela, Rep. Bol."
replace cowcode=101 if Country=="Venezuela"
replace cowcode=101 if Country=="Venezuela, RB"

replace cowcode=816 if Country=="Vietnam"
replace cowcode=816 if Country=="Democratic Republic of Vietnam"
replace cowcode=816 if Country=="Socialist Republic of Vietnam"
replace cowcode=817 if Country=="Republic of Vietnam"

replace cowcode=935 if Country=="Vanuatu"

replace cowcode = 678 if Country=="Yemen Arab Republic (North, Sana)"
replace cowcode = 678 if Country=="Yemen Arab Republic"
replace cowcode = 678 if Country=="North Yemen"

replace cowcode=679 if Country=="Yemen, Republic of"
replace cowcode=679 if Country=="Republic of Yemen"
replace cowcode=680 if Country=="Yemen PDR (South, Aden)"
replace cowcode=680 if Country=="South Yemen"

replace cowcode=679 if Country=="Yemen"

replace cowcode = 680 if Country=="Yemen People's Republic" 
replace cowcode = 680 if Country=="Yemen Peoples Democratic Republic" 
replace cowcode = 679 if Country=="Yemen, Rep." 
replace cowcode = 679 if Country=="Yemen Republic" 

replace cowcode=345 if Country=="Yugoslavia, Fr (serbia/montenegro)"
replace cowcode=345 if Country=="Yugoslavia"
replace cowcode=345 if Country=="Yugoslavia2"
replace cowcode=345 if Country=="Serbia, Republic of"
replace cowcode=345 if Country=="Serbia and Montenegro"

replace cowcode=551 if Country=="Zambia"
replace cowcode=552 if Country=="Zimbabwe"
replace cowcode=552 if Country=="Rhodesia"
replace cowcode=552 if Country=="Zimbabwe-Rhodesia"

replace cowcode=490 if Country=="Congo, Dem. Rep."
replace cowcode=490 if Country=="Congo, Dem. Rep. of"
replace cowcode=490 if Country=="Zaire"
replace cowcode=490 if Country=="Congo, Dem. Rep. (Zaire)"
replace cowcode = 490 if Country == "Congo Democratic Republic"
replace cowcode = 490 if Country=="Congo Democratic Republic of"
replace cowcode = 490 if Country=="Democratic Republic of Congo"



replace cowcode=484 if Country=="Congo"
replace cowcode=484 if Country=="Congo, Rep of"
replace cowcode=484 if Country=="Congo, Rep."
replace cowcode = 484 if Country == "Congo Republic"
replace cowcode= 484 if Country=="Congo, Republic of"
replace cowcode= 484 if Country=="People's Republic of Congo"

sort cowcode Year






